package com.sz.netty.service.impl;

import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.sz.netty.entity.DtuFtpMessageLog;
import com.sz.netty.mapper.NettyDtuFtpMessageLogMapper;
import com.sz.netty.service.DtuFtpMessageLogService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * DTU FTP消息日志服务实现类
 */
@Service
public class NettyDtuFtpMessageLogServiceImpl extends ServiceImpl<NettyDtuFtpMessageLogMapper, DtuFtpMessageLog> implements DtuFtpMessageLogService {
    
    @Override
    public DtuFtpMessageLog saveMessageLog(DtuFtpMessageLog messageLog) {
        // 设置创建时间和更新时间
        Date now = new Date();
        if (messageLog.getCreateTime() == null) {
            messageLog.setCreateTime(now);
        }
        messageLog.setUpdateTime(now);
        
        // 保存到数据库
        this.save(messageLog);
        return messageLog;
    }
}